package com.google.android.apps.wakemewhere;

import java.util.List;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootCompletedReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
			Log.i("WAKEMEWHERE",
					"Boot detected, registering all enabled alarms");
			ProximityAlertAlarmArbiter alarmArbiter = new ProximityAlertAlarmArbiter(
					context);
			AlarmContentObserver observer = new AlarmContentObserver(context,
					alarmArbiter);
			List<Alarm> alarms = observer.getAlarmsFromResolver();
			if (!alarms.isEmpty()) {
				alarmArbiter.addAlarms(observer.getAlarmsFromResolver());
			}
		}
	}
}